{% extends 'base.html' %}
{%block login%}
<ul class="nav navbar-nav navbar-right">
<li><a href="/MLWebService/logout">登出</a></li>
</ul>
{%endblock%}
{% block content %}

    <h2>机器学习训练任务管理</h2>
    <table class="table">
        <caption>存储的数据</caption>
        <thead>
            <tr>
                <td>序号</td>
                <td>模型名</td>
                <td>模型种类</td>
                <td>是否在训练</td>
                <td>上传时间</td>
            </tr>
        </thead>
        <br>
        <tbody>
            {% for result in data %}
                <tr>
                    <td>{{ result.oid}}</td>
                    <td>{{ result.trainingName }}</td>
                    <td>{{ result.typeOfModel}}</td>
                    {% if result.onTraining == -1  %}
                    <td>未训练</td>
                    {% elif result.onTraining == 0%}
                    <td>正在训练</td>
                    {% else%}
                    <td>训练完成</td>
                    {% endif%}
                    <td>{{ result.uploadTime}}</td>
                    {% if result.onTraining == -1  %}
                    <td>
                        <form action="dataframe{{result.oid}}" method="POST"style="float:left " >{% csrf_token %}
                            <input type="submit" value="数据格式" class="btn btn-success">&nbsp;</input>
                        </form>
                        <form action="task{{result.oid}}" method="POST" style="float:left " >{% csrf_token %}
                            <input type="submit" value="训练模型" class="btn btn-primary">&nbsp;</input>
                        </form>
                        <form action="delete{{result.oid}}" method="POST">{% csrf_token %}
                            <input type="submit" value="删除任务" class="btn btn-danger" />
                        </form>
                    </td>
                    {% elif result.onTraining == 0%}
                    <td>请等候</td>
                    {% else%}
                    <td>
                        <form action="dataframe{{result.oid}}" method="POST"style="float:left " >{% csrf_token %}
                            <input type="submit" value="数据格式" class="btn btn-success">&nbsp;</input>
                        </form>
                        <form action="test{{result.oid}}" method="POST"style="float:left " >{% csrf_token %}
                            <input type="submit" value="测试模型" class="btn btn-success">&nbsp;</input>
                        </form>
                        <form action="delete{{result.oid}}" method="POST">{% csrf_token %}
                            <input type="submit" value="删除任务" class="btn btn-danger" />
                        </form>
                    </td>
                    {% endif%}
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}